package com.billdowney.qq.robot.util;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;


public class JieXiDataYongHu {
    public static String  jiexijiami(String data){
        List<Map<String, String>> list5 = new ArrayList<>();
        List<String> list6 = new ArrayList<String>();
        // write your code here
        // HashMap<String,HashMap<String,String>> m = new HashMap<>();
        String arr = "{\'map1\':[{\'name\':\'阚敬征\'},{\'paperstype\':\'372924199707075417\'},{\'mobile\':\'17614806631\'},{\'email\':\'17614806631@qq.com\'}]}";
        JSONObject array = JSON.parseObject(arr);
        for (String k : array.keySet()) {
            JSONArray job = array.getJSONArray(k);
            for (int i = 0; i < job.size(); i++) {
                JSONObject j = job.getJSONObject(i);
                Map<String, String> map = null;
                for (String key : j.keySet()) {
                    map = new HashMap<>();
                    System.out.println(key);
                    System.out.println(j.getString(key));
                    String string = j.getString(key);
                    map.put(key, string);//得到的参数

                        /*
                            按照自己需求存就好
                            if(key.equals("map1")){
							 list5.add(j.getString(key));
						 }else if(key.equals("map2")){
							 list6.add(j.getString(key));
						 }
                        */

                }
                list5.add(map);
            }
            System.out.println(list5.toString());
            return list5.toString();
          //  System.out.println("ok");
        }
        JSONArray jsonarray = (JSONArray) JSONArray.toJSON(list5);
        return jsonarray.toString();
}
}
